package main

import (
	"fmt"
	"go-canal/utils/kafka"
)

type msgStruct struct {
	Source  string
	Payload []map[string]interface{}
}

func main() {
	p := kafka.NewDefaultProducer([]string{"172.16.0.249:9092"})
	for i := 0; i < 1; i++ {
		m := msgStruct{
			Source: "user_login",
			Payload: []map[string]interface{}{
				{"user_id": "22222", "account_id": "231333", "ip": "127.0.0.1", "device_id": "gschjd", "country": "中国", "report_time": 1692935401},
				//{"user_id": "11111", "account_id": "342444", "ip": "localhost", "device_id": "schbsb", "country": "中国", "report_time": 1692936740},
				//{"user_id": "33333", "account_id": "236782", "ip": "192.168.140.200", "device_id": "fdshjx", "country": "美国", "report_time": 1692936758},
			},
		}
		err := p.PutMsg(m, "test")
		if err != nil {
			fmt.Printf("put msg err is %v\n", err)
			return
		}
	}
	for {

	}
}
